package com.woniuxy01;

import java.io.*;

/**
 * @author 作者
 * @create 2025-11-12 11:14
 */
public class Test02 {
    public static void main(String[] args) throws IOException {
//        BufferedWriter bw=
//                new BufferedWriter(new OutputStreamWriter(new FileOutputStream("a.txt")));
        BufferedWriter bw=new BufferedWriter(new FileWriter("a.txt"));
        bw.write("aaa");
        bw.newLine();
        bw.write("bbb");
        bw.newLine();
        bw.write("ccc");
        bw.newLine();
        bw.flush();
        bw.close();

//        BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream("a.txt")));
        BufferedReader br=new BufferedReader(new FileReader("a.txt"));
        String line;
        while((line=br.readLine())!=null){
            System.out.println(line);
        }
        br.close();
    }

    private static void test01() throws IOException {
        //        OutputStreamWriter osw=new OutputStreamWriter(new FileOutputStream("a.txt"));
        FileWriter fw=new FileWriter("a.txt");
        FileReader fr=new FileReader("a.txt");
    }
}
